package com.shell.arouter.demo.arouter;

import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.durian.BaseApp;
import com.durian.base.frame.easyrouter.IntentBuilder;
import com.durian.router.UserRouter;
import com.durian.ui.factory.ViewTools;
import com.henanjianye.soon.communityo2o2.R;
import com.shell.arouter.ui.activity.ActivityCommon;


/**
 * 说明：ActivityLogin
 * <p/>
 * 作者：fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2019-06-21 17:42
 * <p/>
 * 版本：version 1.0
 */
@Route(path = XRouter.Login.page_login)
public class ActivityLogin extends ActivityCommon {

    private TextView tvLogin;

    @Override
    protected int getRootViewResID() {
        return R.layout.activity_login;
    }

    @Override
    public void onInitStart() {
        tvLogin = findViewById(R.id.tv_login);
        tvLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showLoading(false);
                ViewTools.setText(tvLogin,"登录中...");
                BaseApp.runInMainThreadDelayed(2000, new Runnable() {
                    @Override
                    public void run() {
                        shortToast("登录成功");
                        IUserService service = UserRouter.getUserService();
                        UserBean bean = new UserBean();
                        bean.setName("小明");
                        service.loginSuccess(bean);
                        IntentBuilder.builder(getActivity()).setResult();
                    }
                });
            }
        });
    }

    @Override
    public boolean isShowTitleBarBack() {
        return true;
    }

    @Override
    public boolean isShowTitleBar() {
        return true;
    }

    @Override
    public String bindTitleBarText() {
        return "登录";
    }

}
